/// id : 20234
/// username : "13715016626"
/// access_token : "WLbkEUyMRoW0LpHdU0ysO5v5iukSEXNz13715016626"
/// parent_id : 0
/// is_new : 0
/// status : 10
/// access_expire : 1209600
/// has_unionid : 1
/// coupon : []
/// userinfo : {"id":20234,"username":"13715016626","phone":"13715016626","credit":"11111.00","gift_credit":"0.00","freeze_amount":"1146.00","company_name":"赵信","isSetPassword":1,"unionid":"oOI0j1FZ3hm-G8txEWRIiHJh7cG4","parent_id":0,"email":null,"coupon_count":0,"meal_card_count":0,"is_share_bullets":1}

class LoginBean {
  int _id;
  String _username;
  String _accessToken;
  int _parentId;
  int _isNew;
  int _status;
  int _accessExpire;
  int _hasUnionid;
  //List<dynamic> _coupon;
  Userinfo _userinfo;

  int get id => _id;
  String get username => _username;
  String get accessToken => _accessToken;
  int get parentId => _parentId;
  int get isNew => _isNew;
  int get status => _status;
  int get accessExpire => _accessExpire;
  int get hasUnionid => _hasUnionid;
  //List<dynamic> get coupon => _coupon;
  Userinfo get userinfo => _userinfo;

  LoginBean({
      int id, 
      String username, 
      String accessToken, 
      int parentId, 
      int isNew, 
      int status, 
      int accessExpire, 
      int hasUnionid, 
      List<dynamic> coupon, 
      Userinfo userinfo}){
    _id = id;
    _username = username;
    _accessToken = accessToken;
    _parentId = parentId;
    _isNew = isNew;
    _status = status;
    _accessExpire = accessExpire;
    _hasUnionid = hasUnionid;
   // _coupon = coupon;
    _userinfo = userinfo;
}

  LoginBean.fromJson(dynamic json) {
    _id = json["id"];
    _username = json["username"];
    _accessToken = json["access_token"];
    _parentId = json["parent_id"];
    _isNew = json["is_new"];
    _status = json["status"];
    _accessExpire = json["access_expire"];
    _hasUnionid = json["has_unionid"];
    // if (json["coupon"] != null) {
    //   _coupon = [];
    //   json["coupon"].forEach((v) {
    //     _coupon.add(dynamic.fromJson(v));
    //   });
    // }
    _userinfo = json["userinfo"] != null ? Userinfo.fromJson(json["userinfo"]) : null;
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["id"] = _id;
    map["username"] = _username;
    map["access_token"] = _accessToken;
    map["parent_id"] = _parentId;
    map["is_new"] = _isNew;
    map["status"] = _status;
    map["access_expire"] = _accessExpire;
    map["has_unionid"] = _hasUnionid;
    // if (_coupon != null) {
    //   map["coupon"] = _coupon.map((v) => v.toJson()).toList();
    // }
    if (_userinfo != null) {
      map["userinfo"] = _userinfo.toJson();
    }
    return map;
  }

}

/// id : 20234
/// username : "13715016626"
/// phone : "13715016626"
/// credit : "11111.00"
/// gift_credit : "0.00"
/// freeze_amount : "1146.00"
/// company_name : "赵信"
/// isSetPassword : 1
/// unionid : "oOI0j1FZ3hm-G8txEWRIiHJh7cG4"
/// parent_id : 0
/// email : null
/// coupon_count : 0
/// meal_card_count : 0
/// is_share_bullets : 1

class Userinfo {
  int _id;
  String _username;
  String _phone;
  String _credit;
  String _giftCredit;
  String _freezeAmount;
  String _companyName;
  int _isSetPassword;
  String _unionid;
  int _parentId;
  dynamic _email;
  int _couponCount;
  int _mealCardCount;
  int _isShareBullets;

  int get id => _id;
  String get username => _username;
  String get phone => _phone;
  String get credit => _credit;
  String get giftCredit => _giftCredit;
  String get freezeAmount => _freezeAmount;
  String get companyName => _companyName;
  int get isSetPassword => _isSetPassword;
  String get unionid => _unionid;
  int get parentId => _parentId;
  dynamic get email => _email;
  int get couponCount => _couponCount;
  int get mealCardCount => _mealCardCount;
  int get isShareBullets => _isShareBullets;

  Userinfo({
      int id, 
      String username, 
      String phone, 
      String credit, 
      String giftCredit, 
      String freezeAmount, 
      String companyName, 
      int isSetPassword, 
      String unionid, 
      int parentId, 
      dynamic email, 
      int couponCount, 
      int mealCardCount, 
      int isShareBullets}){
    _id = id;
    _username = username;
    _phone = phone;
    _credit = credit;
    _giftCredit = giftCredit;
    _freezeAmount = freezeAmount;
    _companyName = companyName;
    _isSetPassword = isSetPassword;
    _unionid = unionid;
    _parentId = parentId;
    _email = email;
    _couponCount = couponCount;
    _mealCardCount = mealCardCount;
    _isShareBullets = isShareBullets;
}

  Userinfo.fromJson(dynamic json) {
    _id = json["id"];
    _username = json["username"];
    _phone = json["phone"];
    _credit = json["credit"];
    _giftCredit = json["gift_credit"];
    _freezeAmount = json["freeze_amount"];
    _companyName = json["company_name"];
    _isSetPassword = json["isSetPassword"];
    _unionid = json["unionid"];
    _parentId = json["parent_id"];
    _email = json["email"];
    _couponCount = json["coupon_count"];
    _mealCardCount = json["meal_card_count"];
    _isShareBullets = json["is_share_bullets"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["id"] = _id;
    map["username"] = _username;
    map["phone"] = _phone;
    map["credit"] = _credit;
    map["gift_credit"] = _giftCredit;
    map["freeze_amount"] = _freezeAmount;
    map["company_name"] = _companyName;
    map["isSetPassword"] = _isSetPassword;
    map["unionid"] = _unionid;
    map["parent_id"] = _parentId;
    map["email"] = _email;
    map["coupon_count"] = _couponCount;
    map["meal_card_count"] = _mealCardCount;
    map["is_share_bullets"] = _isShareBullets;
    return map;
  }

}